import javax.swing.*;
import java.applet.Applet;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

/**
 * User: dizem@126.com
 * Time: 12-2-22 下午9:57
 */
public class Demo extends Applet {
	private JButton button = new JButton("click here");
	private JTextArea textArea = new JTextArea(5, 20);

	public Demo() throws HeadlessException {
		setSize(300, 200);
		setLayout(new BorderLayout());

		Box box = Box.createHorizontalBox();
		box.add(button);
		add(box, BorderLayout.NORTH);
		add(new JScrollPane(textArea), BorderLayout.CENTER);

		button.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				textArea.append("hello world\n");
			}
		});
	}
}
